"""config URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/4.1/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path
from Web.backend.views import index, tackle, model, dataset, algorithm, run_transfer
from Web.backend.views.run_transfer import run_transfer
from django.conf import settings
from django.conf.urls.static import static

urlpatterns = [
    path('', index.index, name='index'),
    path('index.html', index.index, name='index'),
    path('index.html/<str:nid>/<int:datatype>', index.findimg),
    path('tackle.html/<str:scene_id>/<str:date>/<str:taskname>/1', tackle.tackle),
    path('tackle.html', tackle.tackle0),
    path('tackle.html/<str:scene_id>/<str:lng>/<str:lat>/<str:date>', tackle.tackle1),
    path('get_model', model.get_model),                            # 获取全部模型信息
    path('get_model/<str:model_id>', model.get_one_model),         # 获取指定模型信息
    path('upload', model.model_upload),                            # 上传模型

    path('change_model', model.model_change),                      # 修改模型信息
    path('get_model_data/<str:model_id>', model.model_data),       # 获取指定模型信息
    path('model_validate/<str:model_id>', model.model_validate),   # 模型检验
    path('model_compress/<str:model_id>', model.model_compress),   # 模型压缩
    path('model_test/<str:model_id>', model.model_test),           # 模型测试
    path('deploy', model.deploy),                                  # 模型上星
    path('show_deploy', model.show_deploy),                        # 获取对应卫星上的模型

    path('get_dataset', dataset.get_dataset),                         # 获取数据集
    path('change_dataset', dataset.change_dataset),                   # 修改数据集
    path('del_dataset', dataset.del_dataset),                         # 删除数据集

    path('get_algorithm', algorithm.get_algorithm),                # 获取算法
    path('change_algorithm', algorithm.change_algorithm),          # 修改算法信息
    path('del_algorithm', algorithm.del_algorithm),                # 删除算法
    # path('copy_algorithm', algorithm.copy_algorithm),              # 复制算法
    path('run-transfer/', run_transfer, name='run_transfer'),  # 上传并运行模型
]
if settings.DEBUG:
    urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
    urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
